mui.init();
function formatterDateTime() {
var date=new Date()
var month=date.getMonth() + 1
        var datetime = date.getFullYear()
                + ""// "年"
                + (month >= 10 ? month : "0"+ month)
                + ""// "月"
                + (date.getDate() < 10 ? "0" + date.getDate() : date
                        .getDate())
                + ""
                + (date.getHours() < 10 ? "0" + date.getHours() : date
                        .getHours())
                + ""
                + (date.getMinutes() < 10 ? "0" + date.getMinutes() : date
                        .getMinutes())
                + ""
                + (date.getSeconds() < 10 ? "0" + date.getSeconds() : date
                        .getSeconds());
        return datetime;
    }
////////////侧边栏
$.ajax({
    type: 'post',
    url: 'http://route.showapi.com/109-34',
    dataType: 'json',
    data: {
        "showapi_timestamp": formatterDateTime(),
        "showapi_appid": '75578', //这里需要改成自己的appid
        "showapi_sign": '7f008ce3cecd4dcca306593863958d9b',  //这里需要改成自己的应用的密钥secret
    },
    success: function(result) {
        //console.log(result) //console变量在ie低版本下不能用
        var data1=result.showapi_res_body.channelList.slice(0,11);
       	var str='';
       	$.each(data1, function(index,val) {
//     		console.log(val)
       		str+=`<a href="javascript:;" id='${val.channelId}'>${val.name}</a>`;
       		$('.ce_list').html(str);
       	});
       	$('.ce_list').on('touchend','a',function(){
       			var Id=this.getAttribute('id');
       			function formatterDateTime() {
				  var date=new Date()
				  var month=date.getMonth() + 1
				        var datetime = date.getFullYear()
				                + ""// "年"
				                + (month >= 10 ? month : "0"+ month)
				                + ""// "月"
				                + (date.getDate() < 10 ? "0" + date.getDate() : date
				                        .getDate())
				                + ""
				                + (date.getHours() < 10 ? "0" + date.getHours() : date
				                        .getHours())
				                + ""
				                + (date.getMinutes() < 10 ? "0" + date.getMinutes() : date
				                        .getMinutes())
				                + ""
				                + (date.getSeconds() < 10 ? "0" + date.getSeconds() : date
				                        .getSeconds());
				        return datetime;
				    }
       			//////////////////主体的覆盖
       			$.ajax({
				    type: 'post',
				    url: 'http://route.showapi.com/109-35',
				    dataType: 'json',
				    data: {
				        "showapi_timestamp": formatterDateTime(),
				        "showapi_appid": '75578', //这里需要改成自己的appid
        				"showapi_sign": '7f008ce3cecd4dcca306593863958d9b',  //这里需要改成自己的应用的密钥secret
				        "channelId":Id,
				        "channelName":"",
				        "title":"",
				        "page":"1",
				        "needContent":"0",
				        "needHtml":"0",
				        "needAllList":"0",
				        "maxResult":"20",
				        "id":""
				    },
				    success: function(result) {
				        var liebiao=result.showapi_res_body.pagebean.contentlist;
				        var strLie='';
				        $.each(liebiao, function(index,val) {
				        	console.log(val)
				        	if(val.imageurls.length==0){
				        		strLie+=`<li class="mui-table-view-cell mui-media">
					       		<a href="javascript:;" class='yi' id='xinlang' desc='${val.desc}' Title='${val.title}'>
					                        <div class="mui-media-body">
					                            	${val.title}
					                            <p class="mui-ellipsis">${val.pubDate}</p>
					                        </div>
					                    </a></li>
					                    `;
					       		$('.mui-table-view').html(strLie);
					       		$('.header h1').html(val.channelName);
				        	}else{
				        		strLie+=`<li class="mui-table-view-cell mui-media">
				       		<a href="javascript:;" class='yi' id='xinlang' desc='${val.desc}' Img='${val.imageurls[0].url}' Title='${val.title}'>
				                        <div class="mui-media-body">
				                            	${val.title}
				                            <p class="mui-ellipsis">${val.pubDate}</p>
				                        </div>
				                    </a></li>
				                    `;
				       		$('.mui-table-view').html(strLie);
				       		$('.header h1').html(val.channelName);
				        	}
				       	});
				    }
				});
       		})
    }
});
////////////////主体数据
$.ajax({
    type: 'post',
    url: 'http://route.showapi.com/109-35',
    dataType: 'json',
    data: {
        "showapi_timestamp": formatterDateTime(),
        "showapi_appid": '75578', //这里需要改成自己的appid
        "showapi_sign": '7f008ce3cecd4dcca306593863958d9b',  //这里需要改成自己的应用的密钥secret
        "channelId":"5572a109b3cdc86cf39001de",
        "channelName":"国际最新",
        "title":"",
        "page":"1",
        "needContent":"0",
        "needHtml":"0",
        "needAllList":"0",
        "maxResult":"20",
        "id":""

    },
    success: function(result) {
        var data1=result.showapi_res_body.pagebean.contentlist;
//      console.log(data1)
       	var str='';
       	$.each(data1, function(index,val) {
       		if(val.imageurls.length==0){
        		str+=`<li class="mui-table-view-cell mui-media">
	       		<a href="javascript:;" class='yi' id='xinlang' desc='${val.desc}' Title='${val.title}'>
	                        <div class="mui-media-body">
	                            	${val.title}
	                            <p class="mui-ellipsis">${val.pubDate}</p>
	                        </div>
	                    </a></li>
	                    `;
	       		$('.mui-table-view').html(str);
        	}else{
        		str+=`<li class="mui-table-view-cell mui-media">
       		<a href="javascript:;" class='yi' id='xinlang' desc='${val.desc}' Img='${val.imageurls[0].url}' Title='${val.title}'>
                        <div class="mui-media-body">
                            	${val.title}
                            <p class="mui-ellipsis">${val.pubDate}</p>
                        </div>
                    </a></li>
                    `;
       		$('.mui-table-view').html(str);
        	}
       		
       	});
    }
});